#pragma once

#include <memory>

//获取到静态实例
template <class T, class X, int N>
T& GetInstanceX(){
    static T v;
    return v;
}
//获取静态实例的智能指针
template <class T, class X, int N>
std::shared_ptr<T> GetInstancePtr(){
    static std::shared_ptr<T> v(new T);
    return v;
}

template <class T, class X = void, int N = 0>
class Singleton{
public:
    static T* GetInstance(){
        static T v;
        return &v; //返回裸指针
    }
};

template <class T, class X = void, int N = 0>
class SingletonPtr{
public:
    static std::shared_ptr<T> GetInstance(){
        static std::shared_ptr<T> v(new T);
        return v; //返回单例智能指针
    }
};

